#pragma once

#include "apdu.h"
#include "apdu_mgr_base.h"

class apdu_manager : public apdu_mgr_base
{
public:
	apdu_manager(void);
	~apdu_manager(void);

public:

	apdu * create_apdu_create_application(unsigned char * app_settings, int data_len);

	apdu * create_apdu_update_application(int app_id, unsigned char * app_settings, int data_len );

	apdu * create_apdu_enum_application();

	apdu * create_apdu_delete_application(char * app_name);

	apdu * create_apdu_open_application(char * app_name);

	apdu * create_apdu_close_application(int app_id);

	apdu * create_apdu_get_ext_app_info(int app_id);

	apdu * create_apdu_create_file(int app_id, unsigned char * file_attrs, int attrs_len);

	apdu * create_apdu_delete_file(int app_id, char * file_name);

	apdu * create_apdu_enum_files(int app_id);

	apdu * create_apdu_get_file_info(int app_id, char * file_name);

	apdu * create_apdu_read_file(int app_id, int offset, int read_len, char * file_name);

	apdu * create_apdu_write_file(int app_id, int offset, char * file_name, unsigned char * data, int data_len);

	apdu * create_apdu_crypt_read_file(int app_id, int container_id, int key_id, int offset, int read_len, char * file_name, int is_final);

	apdu * create_apdu_crypt_write_file(int app_id,int container_id, int key_id, int offset, char * file_name, unsigned char * data, int data_len, int is_final);

	apdu * create_apdu_set_file_info( int app_id, char * file_name, unsigned char * file_attrs, int attrs_len);

	apdu * create_apdu_set_current_file_pos(int pos);

	apdu * create_apdu_create_container(int app_id, char * container_name);

	apdu * create_apdu_open_container(int app_id, char * container_name);

	apdu * create_apdu_close_container(int app_id, int container_id);

	apdu * create_apdu_enum_container(int app_id);

	apdu * create_apdu_delete_container(int app_id, char * container_name);

	apdu * create_apdu_get_containter_info(int app_id, char * container_name);

	apdu * create_apdu_get_container_name_by_id(int app_id, int container_id);

	apdu * create_apdu_import_certificate_head(int app_id, int container_id, int cert_type, unsigned long total_len);

	apdu * create_apdu_export_certificate(int app_id, int containter_id, int cert_type);

	apdu * create_apdu_gen_random(int len, int saveToFile);

	apdu * create_apdu_get_container_ex_info(int app_id, int container_id, int offset, int data_len);

	apdu * create_apdu_set_container_ex_info(int app_id, int container_id, int offset, 
							unsigned char * pData, int data_len);

};
